"""
序列化：模型对象--》字典--〉json
通过基础DRM的ModelSerializer类自定义序列器实现模型对象化序列
"""
from rest_framework.serializers import ModelSerializer

from user.models import Post, Comment, News, User


class PostSerializer(ModelSerializer):
    class Meta:
        model = Post
        fields = '__all__'


class CommentSerializer(ModelSerializer):
    class Meta:
        model = Comment
        fields = '__all__'


class NewsSerializer(ModelSerializer):
    class Meta:
        model = News
        fields = '__all__'


class UserSerializer(ModelSerializer):
    class Meta:
        model = User
        fields = '__all__'
